#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct studentscore{
	char name[20];
	double chinese;
	double english;
	double math;
	double sum;
};
//输入学生成绩
void addscore(struct studentscore s[],int i){
        printf("请输入学生的姓名、语文成绩、英语成绩、数学成绩：\n");
		scanf("%s %lf %lf %lf",s[i].name,&s[i].chinese,&s[i].english,&s[i].math);
		printf("\n");
		s[i].sum=s[i].chinese+s[i].english+s[i].math;//计算总成绩
		printf("姓名：%s\n  语文成绩：%2lf\n  英语成绩：%2lf\n  数学成绩：%2lf\n  总成绩：%2lf\n",s[i].name,s[i].chinese,s[i].english,s[i].math,s[i].sum);
	
}
int main(int argc, char *argv[]) {
	struct studentscore s[1000];
	int num=0;
	printf("请输入班级学生总人数：\n");
	scanf("%d",&num);
	printf("\n");
	int i;
	for (i=1;i<=num;i++){
	printf("请输入第%d个学生的信息.\n",i);
		addscore(s,i);	
	}	
	return 0;
}